Passed
Push — master ( 1adf40...f067da )
by lv
01:05
created

http_error.js ➔ ???   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 14
nc 3
dl 0
loc 19
c 0
b 0
f 0
rs 9.7
nop 2
1
//页面错误处理
2
module.exports = async function (ctx, next) {
3
	await next()
4
	if (parseInt(ctx.status) === 404) {
5
		ctx.body = {
6
			code: 404,
7
			success: false,
8
			data: [],
9
			msg: '没有找到页面'
10
		}
11
	}
12
	else if (parseInt(ctx.status) === 403) {
13
		ctx.body = {
14
			code: 403,
15
			success: false,
16
			data: [],
17
			msg: '权限不足'
18
		}
19
	}
20
}
21
22